import React, { useEffect, useState } from "react";
import Camera, { getUserMedia } from "../dist";
import { useNavigate } from "react-router-dom";
import { Button } from "mooli-mobile";

function App() {
  const history = useNavigate();
  const play = () => {
    getUserMedia().then((res) => {
      if (res.success) {
        history("/result");
      }
    });
  };
  return (
    <div className="App">
      <h3>Webrtc视频录制-Demo</h3>
      <p style={{ padding: 20 }}>
        <Button type="info" block onClick={play}>
          开始录制
        </Button>
      </p>
    </div>
  );
}

export default App;
